package StudyCode.summary.mycollection;

import java.util.Collection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ConvertsCollectionToAStringArrayByCallingToStringOnEachMember {
	public static void main(String[] argv) {
		Collection collection = java.util.Arrays.asList("asdf",
				"www.tah1986.com");
		System.out.println(java.util.Arrays
				.toString(toStringArray(collection)));
	}

	public static String[] toStringArray(Collection collection) {
		String[] stringArray = new String[collection.size()];

		int i = 0;
		for (Object string : collection) {
			stringArray[i++] = string.toString();
		}

		return stringArray;
	}
}
